using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace AntEater.Runtime.UI
{
    /// <summary>
    /// Specifies the state of a target execution.
    /// </summary>
    internal enum TargetExecutionState
    {
        /// <summary>
        /// Specifies the initial status.
        /// </summary>
        None = 0,

        /// <summary>
        /// Execution succeed.
        /// </summary>
        Succeeded = 1,

        /// <summary>
        /// Execution failed.
        /// </summary>
        Failed = 2
    }

    /// <summary>
    /// Provides a control for visualizing the state of a target execution. 
    /// </summary>
    internal partial class TargetExecutionStateView : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TargetExecutionStateView"/> class.
        /// </summary>
        public TargetExecutionStateView() {
            InitializeComponent();
            this._state = TargetExecutionState.None;
        }

        private TargetExecutionState _state;

        /// <summary>
        /// Gets or sets the state.
        /// </summary>
        /// <value>The state.</value>
        public TargetExecutionState State {
            get { return _state; }
            set {
                _state = value;

                switch (_state) {
                    case TargetExecutionState.Succeeded:
                        stateTextLabel.Text = "Succeeded";
                        statePictureBox.Image = stateImageList.Images["Succeeded"];
                        break;
                    case TargetExecutionState.Failed:
                        stateTextLabel.Text = "Failed";
                        statePictureBox.Image = stateImageList.Images["Failed"];
                        break;
                    case TargetExecutionState.None:
                    default:
                        stateTextLabel.Text = "Unknown";
                        statePictureBox.Image = stateImageList.Images["None"]; 
                        break;
                }

            }
        }
    }

}
